<template>
  <ul class="classify_ul">
        <li v-for="item, i in items">
           <p>{{ item }}</p>
        </li>
    </ul>
</template>

<script>

export default {
  template: '#myTemplate',
  props: ['type'],
  data() {
    return {
      items : []
    }
  },
  watch: {
    type(newV, oldV){
    console.log(this.type)
      this.loadData()
    }
  },
  methods: {
    loadData() {
      this.$http.get('http://localhost:8080/static/classify.json').then(function(res){
     
        this.items = res.body.data[this.type]
      })
    }
  },
  mounted() {
    // 参数没有传过来
    console.log(this.type) //undefined 为什么是undefined
    this.loadData();
  },
  updated() {

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
